package com.own.util;

import java.util.Set;

import com.own.core.object.Dao;

public class Converter {
	public static String convertToString(Set set) {
		StringBuilder str = new StringBuilder();

		try {
			if (set == null || set.size() == 0) {
				return "";

			}

			str.append("(");
			for (Object obj : set) {

				Dao dao = (Dao) obj;
				str.append(dao.getName());
				str.append(",");
			}
			str.deleteCharAt(str.length() - 1);
			str.append(")");
		} catch (Exception e) {

		}
		return str.toString();
	};

	public static String convertToString(Object object) {
		if (object == null) {
			return "";

		}
		if (object instanceof Set) {
			return convertToString((Set) object);
		} else if (object instanceof String) {
			return object.toString();
		}

		StringBuilder str = new StringBuilder();
		str.append("(");

		str.append(object.toString());
		str.append(")");

		return str.toString();
	};

}
